import 'package:beautiful_demo/common/empty.dart';
import 'package:beautiful_demo/common/res.dart';
import 'package:beautiful_demo/common/widget/button.dart';
import 'package:beautiful_demo/common/widget/statebar.dart';

import 'controller.dart';
import 'package:flutter/material.dart';
import 'widget.dart';
import 'package:flutter_mvc/flutter_mvc.dart';

///description:聊天列表
class ChatListPage extends BasePage<ChatListController> {
  @override
  Widget build(BuildContext context) {
    return SystemStateBar(
      child: Material(
        color: Colors.white,
        child: SafeArea(
          bottom: false,
          child: Column(
            children: [
              ScreenWidget(),
              Expanded(
                child: IndexedStack(
                  index: c.index,
                  children: [
                    ListView.builder(
                      physics: const BouncingScrollPhysics(),
                      padding: EdgeInsets.only(
                          bottom: MediaQuery.of(context).padding.bottom + 60.dp),
                      itemBuilder: (ctx, index) {
                        final item=c.dataList[index];
                        return InkWell(onTap: ()=>c.onItemClick(item),child: Item(item.receiveLogo, item.receiveNick, item.lastMessage,item.lastTime, item.num.toString()));
                      },
                      itemCount: c.dataList.length,
                    ),
                    c.chatFriendController.widget
                  ],
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
